#ifndef __INTERRUPT_H
#define __INTERRUPT_H

#include "gpio.h"

/***********************************************************************************************************************
�ж��������
***********************************************************************************************************************/
#define GLOBAL_INTERRUPT_ENABLE()    do{SET_Bit(IE, 7);}while(0)
#define GLOBAL_INTERRUPT_DISABLE()   do{CLR_Bit(IE, 7);}while(0)

#define INTERRUPT_TIMER2_ENABLE()    do{SET_Bit(IE, 5);}while(0)
#define INTERRUPT_TIMER2_DISABLE()   do{CLR_Bit(IE, 5);}while(0)

#define INTERRUPT_UART_ENABLE()      do{SET_Bit(IE, 4);}while(0)
#define INTERRUPT_UART_DISABLE()     do{CLR_Bit(IE, 4);}while(0)

#define INTERRUPT_TIMER1_ENABLE()    do{SET_Bit(IE, 3);}while(0)
#define INTERRUPT_TIMER1_DISABLE()   do{CLR_Bit(IE, 3);}while(0)
                                   
#define INTERRUPT_EXTERN1_ENABLE()   do{SET_Bit(IE, 2);}while(0)
#define INTERRUPT_EXTERN1_DISABLE()  do{CLR_Bit(IE, 2);}while(0)

#define INTERRUPT_TIMER0_ENABLE()    do{SET_Bit(IE, 1);}while(0)
#define INTERRUPT_TIMER0_DISABLE()   do{CLR_Bit(IE, 1);}while(0)

#define INTERRUPT_EXTERN0_ENABLE()   do{SET_Bit(IE, 0);}while(0)
#define INTERRUPT_EXTERN0_DISABLE()  do{CLR_Bit(IE, 0);}while(0)

#define INTERRUPT_EXTERN0_LEVEL()    do{CLR_Bit(TCON, 0);}while(0)
#define INTERRUPT_EXTERN0_FALLING()  do{SET_Bit(TCON, 0);}while(0)

/***********************************************************************************************************************
�ж����ȼ�����
***********************************************************************************************************************/
#define TIMER2_PRIORITY_HIGHT    0x10                                        
#define UART_PRIORITY_HIGHT      0x10
#define TIMER1_PRIORITY_HIGHT    0x08   
#define EXTERN1_PRIORITY_HIGHT   0x04
#define TIMER0_PRIORITY_HIGHT    0x02
#define EXTERN0_PRIORITY_HIGHT   0x01

#endif